package com.basic.service;

import com.basic.model.quartz.BasicJobManager;
import com.basic.model.quartz.param.TestTaskParam;
import lombok.extern.slf4j.Slf4j;
import org.quartz.SchedulerException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class TestService {

    @Autowired
    private BasicJobManager basicJobManager;

    public void test() throws SchedulerException {

        TestTaskParam.Body body = new TestTaskParam.Body();
        body.setKey("eeafdas");
        TestTaskParam testTaskParam = new TestTaskParam(body);
        log.info("addDelayJob:" + body);
        basicJobManager.addDelayJob(testTaskParam, System.currentTimeMillis() + 5000);

    }

    public void test2() throws SchedulerException {
        TestTaskParam.Body body = new TestTaskParam.Body();
        body.setKey("eeafdas");
        TestTaskParam testTaskParam = new TestTaskParam(body);
        basicJobManager.removeJob(testTaskParam);
    }
}
